function fillBrandsCombo(id, colonElements) {
    if ($('#' + id).length > 0) {
        var optionsValues = "";
        if (colonElements != null) {
            var items = colonElements.split(";");
            var count = items.length;
            for (var i = 0; i < count; i++) {
                var options = items[i].split(",");
                if (options[0] != "") {
                    optionsValues += '<option value="' + options[1] + '">' + options[0] + '</option>';
                }   //if
            } //for
            $('#' + id).html(optionsValues);
        }   //if
    }   //if
}

function fillModelsCombo(id, colonElements) {
    if ($('#' + id).length > 0) {
        var optionsValues = "";
        if (colonElements != null) {
            var items = colonElements.split(";");
            var count = items.length;
            for (var i = 0; i < count; i++) {
                var options = items[i].split("|");
                if (options[0] != "") {
                    optionsValues += '<option value="' + options[1] + '">' + options[0] + '</option>';
                }   //if
            } //for
            $('#' + id).html(optionsValues);
        }   //if
    }   //if
}

function fillVehiclesCombo(id, colonElements) {
    if ($('#' + id).length > 0) {
        var optionsValues = "";
        if (colonElements != null) {
            var items = colonElements.split(";");
            var count = items.length;
            for (var i = 0; i < count; i++) {
                var options = items[i].split("|");
                if (options[0] != "") {
                    optionsValues += '<option value="' + options[1] + '">' + options[0] + '</option>';
                }   //if
            } //for
            $('#' + id).html(optionsValues);
        }   //if
    }   //if
}

function doMainSearchRedirectWix(vehicleId, manufacturerId, modelId, languageName, prelink) {
    if (typeof prelink === "undefined") {
        prelink = "http://wixeurope.com/";
    }
    if (vehicleId && manufacturerId && modelId) {
        var vehicleIdInt = parseInt(vehicleId);
        if (isNaN(vehicleIdInt)) {
            return false;
        }
        switch (vehicleIdInt) {
            case 6:
                window.location = prelink + getTranslation("mainSearchWixHighway", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 7:
                window.location = prelink + getTranslation("mainSearchWixPassenger", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 8:
                window.location = prelink + getTranslation("mainSearchWixHeavy", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 9:
                window.location = prelink + getTranslation("mainSearchWixMotorcycle", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 10:
                window.location = prelink + getTranslation("mainSearchWixQuad", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 11:
                window.location = prelink + getTranslation("mainSearchFiltronOther", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;                
            default:
                return false;
        }
    }
}

function doMainSearchRedirectFiltron(vehicleId, manufacturerId, modelId, languageName, prelink) {
    if (typeof prelink === "undefined") {
        prelink = "http://wixeurope.com/";
    }
    if (vehicleId && manufacturerId && modelId) {
        var vehicleIdInt = parseInt(vehicleId);
        if (isNaN(vehicleIdInt)) {
            return false;
        }
        switch (vehicleIdInt) {
            case 1:
                window.location = prelink + getTranslation("mainSearchFiltronMachines", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 11:
                window.location = prelink + getTranslation("mainSearchFiltronOther", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 2:
                window.location = prelink + getTranslation("mainSearchFiltronPassenger", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 3:
                window.location = prelink + getTranslation("mainSearchFiltronTruck", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 6:
                window.location = prelink + getTranslation("mainSearchWixHighway", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 7:
                window.location = prelink + getTranslation("mainSearchWixPassenger", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 8:
                window.location = prelink + getTranslation("mainSearchWixHeavy", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 9:
                window.location = prelink + getTranslation("mainSearchWixMotorcycle", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case 10:
                window.location = prelink + getTranslation("mainSearchWixQuad", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            default:
                return false;
        }
    }
}

function doMakeSearchByStringWix(queryval, languageName, prelink) {
    if (typeof prelink === "undefined") {
        prelink = "http://wixeurope.com/";
    }
    if (queryval) {
        queryval = queryval.split(' ').join('');
        queryval = queryval.split('-').join('');
        queryval = queryval.split('/').join('');
        window.location = prelink + getTranslation("searchByCrosses", languageName) + "?filter_number=" + queryval + "&languageName=" + languageName;
    }   //if
}
